package com.bytz.modules.cms.domain.impl.order;

import com.bytz.common.exception.BytzBootException;
import com.bytz.modules.cms.domain.MallOrderProcessor;
import com.bytz.modules.cms.domain.model.order.MallOrderProcessContext;
import com.bytz.modules.cms.order.constant.OrderConstants;
import com.bytz.modules.cms.order.model.OrderModel;

/**
 * 订单类型处理器 2
 * @author shanxuezhong
 */
public class MallOrderTypeProcessor extends MallOrderAbstractProcessor implements MallOrderProcessor {


    public MallOrderTypeProcessor(int sequence) {
        super(sequence);
    }

    @Override
    public void doProcess(MallOrderProcessContext context) {
        OrderModel order = context.getOrder();

        // 根据订单类型核对价格
        if (OrderConstants.OrderType.STANDARD.equals(order.getOrderType())) {
            context.setStandardOrder(true);
        } else if (OrderConstants.OrderType.PROJECT.equals(order.getOrderType())) {
            context.setProjectOrder(true);
        } else {
            throw new BytzBootException("未知的订单类型");
        }
    }
}